
import './index.scss';

window.av = {};
av.doing = false;

import './module/extends';
import './module/ajax';
import './module/cookie';
import './module/dialog';
import './module/av.x';


av.head = function (s) {
    s = $.trim(s);
    if (s[0] != '<') {
        s = '<h1>' + s + '</h1>';
    }
    $('.htitle').html(s);
};

!(function(){
    if (!window.JSON) {
        var sc = document.createElement('script');
        sc.src = '//cdn.bootcss.com/json2/20160511/json2.min.js';
        document.head.appendChild(sc);
    }
    $.trim = $.trim || function (s) {
        return s.replace(/^\s+|\s+$/g, '');
    };
}());
$(function(){
    // 获取当前浏览器是否需要fastclick
    window.useFast = !FastClick.notNeeded(document.body);
    // 如果需要则引入fastclick
    if (useFast) {
        FastClick.attach(document.body);
    }
    
    $('body').on('click', '[data-href]', function (event) {
        window.location.href = $(this).attr('data-href');
        event.preventDefault();
    });
});